package com.dailyblue.java.project.smbms.user.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dailyblue.java.project.smbms.user.bean.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper extends BaseMapper<User> {

    List<User> findUserByUserNameAndRoleId(@Param("userName") String userName, @Param("roleId") Integer roleId);

    @Insert("insert into smbms_user values(null,#{userCode},#{userName},#{userPassword},#{gender},#{birthday},#{phone},#{address},#{userRole},1,now(),null,null,1)")
    void saveUser(User user);

    @Update("update smbms_user set userName=#{userName},gender=#{gender},birthday=#{birthday},phone=#{phone},address=#{address},userRole=#{userRole} where id=#{id}")
    void updateUser(User user);
    @Select("select * from smbms_user where userCode=#{userCode}")
    User findUserByUserName(String userCode);
}
